<template>
  <div class="employees-container">
    <div class="app-container">
      <el-card>
        <el-tabs v-model="active">
          <el-tab-pane name="account" label="登录账户设置">
            <Loginsetting :user-info="userInfo" />
          </el-tab-pane>
          <el-tab-pane name="detail" label="个人详情">
            <UserInfo :user-info="userInfo" />
          </el-tab-pane>
          <el-tab-pane label="岗位信息">
            <Zava :activer="userInfo" />
          </el-tab-pane>
        </el-tabs>
      </el-card>
    </div>
  </div>
</template>
<script>
// 导入登陆设置页
import Loginsetting from './components/login-setting.vue'
// 导入个人详情页
import UserInfo from './components/user-info.vue'
// 导入员工个人信息的接口 + 保存员工信息
import { getUserDetailById } from '@/api/user'
// 导入个人信息
import Zava from './components/zvtac.vue'
export default {
  components: {
    Loginsetting,
    UserInfo,
    Zava
  },
  data () {
    return {
      active: 'detail',
      userId: this.$route.params.id, // 获取员工id
      userInfo: {} // 用户信息
    }
  },
  // 页面创建加载
  created () {
    // 获取员工个人信息
    this.hGetUserInfoById()
  },
  methods: {
    // 获取员工个人信息
    async hGetUserInfoById () {
      // 发送请求获取员工个人数据
      const data = await getUserDetailById(this.userId)
      // 给userInfo 赋值
      this.userInfo = data
      console.log(this.userInfo)
    }

  }
}
</script>
